package User;

import operation.chef.Ioperation;
import operation.chef.*;
import zy.Warehouse;

import java.util.Scanner;

/*
 *@Student 张策
 */
public class Chef{
    protected Ioperation[]ioperations;
        public  void doOperation(int choice, Warehouse warehouse){
            this.ioperations[choice].work(warehouse);
    }
    public Chef(){
        this.ioperations=new Ioperation[]{
                null,
                new chef1(),
                new chef2(),
                new chef3(),
                new chef4(),
                new chef5(),
        };
    }
    public int menu() {
        System.out.println("---------后厨管理模块--------");
        System.out.println("1:仓库管理");
        System.out.println("2:菜单管理");
        System.out.println("3:订单管理");
        System.out.println("4:查看余额");
        System.out.println("5:用户列表");
        System.out.println("6:返回上一级");
        System.out.println();
        System.out.println("请输入您的选择:");
        Scanner scanner=new Scanner(System.in);
        int choice;

        while (true) {//判断输入是否合理
            String input = scanner.nextLine();
            try {
                choice = Integer.parseInt(input);

                if (choice >= 1 && choice <= 6) {
                    break;
                } else {
                    System.out.println("输入的数字不在1~6之间，请重新输入！");
                }
            } catch (NumberFormatException e) {
                System.out.println("输入的不是数字，请重新输入！");
            }
        }
        return choice;
    }
}
